<%--
  Created by IntelliJ IDEA.
  User: tao95
  Date: 2017/5/7
  Time: 18:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    String staticPath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
%>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="/static/css/pintuer.css">
    <link rel="stylesheet" href="/static/css/admin.css">
    <script src="/static/js/jquery.js"></script>
    <script src="/static/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 课程表--- ${days}</strong>
        </div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
            <c:if test="${sessionScope.admin != null}">
                <li>
                    <a class="button border-main icon-plus-square-o" href="add.html">
                        添加内容
                    </a>
                </li>
            </c:if>

                <li> 请选择实验室
                        <select id="laboratoryId" name="laboratoryId" class="input" style="width:200px; line-height:17px;display:inline-block">
                            <c:forEach var="item" items="${labList}">
                                <option value="${item.id}">${item.name}</option>
                            </c:forEach>
                        </select>
                </li>
                <li> 请选择星期
                    <select id="daysId" name="daysId" class="input" style="width:200px; line-height:17px;display:inline-block" >
                        <option value="1">星期一</option>
                        <option value="2">星期二</option>
                        <option value="3">星期三</option>
                        <option value="4">星期四</option>
                        <option value="5">星期五</option>
                    </select>
                </li>
                <li>
                    <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>

                </li>
                </form>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="100" style="text-align:left; padding-left:20px;">节次</th>
                <th width="10%">实验室</th>
                <th>课程名</th>
                <th>班级名称</th>
                <th>教师名称</th>
                <th>教师电话</th>
                <th>备注</th>
            <c:if test="${sessionScope.admin != null}">
                <th width="310">操作</th>
            </c:if>
            </tr>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>早餐时间，注意早起，注意锻炼</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <c:if test="${sessionScope.admin != null}">
                        <td></td>
                    </c:if>
                </tr>

                <tr>
                    <input type="hidden" name="id"  value="${oneCourse.id}" />
                    <td> 第一节</td>
                    <td>${oneCourse != null ? oneCourse.laboratoryName:"无"}</td>
                    <td>${oneCourse != null ? oneCourse.courseName:"无"}</td>
                    <td>${oneCourse != null ? oneCourse.className:"无"}</td>
                    <td><font color="#00CC99">${oneCourse != null ? oneCourse.teacherName:"无"}</font></td>
                    <td>${oneCourse != null ? oneCourse.teacherPhone:"无"}</td>
                    <td>${oneCourse != null ? oneCourse.remark:"无"}</td>
                    <c:if test="${sessionScope.admin != null}">
                    <td>
                        <c:choose>
                            <c:when test="${oneCourse != null }">
                            <div class="button-group">
                                <a class="button border-main" href="<%=basePath%>toEditCTR?id=${oneCourse.id}">
                                    <span class="icon-edit"></span> 修改
                                </a>
                                <a class="button border-red" href="javascript:void(0)" onclick="return del(${oneCourse.id})">
                                    <span class="icon-trash-o"></span> 删除</a>
                            </div>
                            </c:when>
                            <c:otherwise></c:otherwise>
                        </c:choose>
                    </td>
                    </c:if>
                </tr>
            <tr>
                <input type="hidden" name="id"  value="${secondCourse.id}" />
                <td> 第二节</td>
                <td>${secondCourse != null ? secondCourse.laboratoryName:"无"}</td>
                <td>${secondCourse != null ? secondCourse.courseName:"无"}</td>
                <td>${secondCourse != null ? secondCourse.className:"无"}</td>
                <td><font color="#00CC99">${secondCourse != null ? secondCourse.teacherName:"无"}</font></td>
                <td>${secondCourse != null ? secondCourse.teacherPhone:"无"}</td>
                <td>${oneCourse != null ? secondCourse.remark:"无"}</td>
                <c:if test="${sessionScope.admin != null}">
                    <td>
                        <c:choose>
                            <c:when test="${secondCourse != null }">
                                <div class="button-group">
                                    <a class="button border-main" href="<%=basePath%>toEditCTR?id=${secondCourse.id}">
                                        <span class="icon-edit"></span> 修改
                                    </a>
                                    <a class="button border-red" href="javascript:void(0)" onclick="return del(${secondCourse.id})">
                                        <span class="icon-trash-o"></span> 删除</a>
                                </div>
                            </c:when>
                            <c:otherwise></c:otherwise>
                        </c:choose>
                    </td>
                    </c:if>
            </tr>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>午餐时间，注意午休，注意饮食</td>
                    <td></td>
                    <td></td>
                    <td></td>
                     <c:if test="${sessionScope.admin != null}">
                    <td></td>
                    </c:if>
                </tr>
            <tr>
                <input type="hidden" name="id"  value="${threeCourse.id}" />
                <td> 第三节</td>
                <td>${threeCourse != null ? threeCourse.laboratoryName:"无"}</td>
                <td>${threeCourse != null ? threeCourse.courseName:"无"}</td>
                <td>${threeCourse != null ? threeCourse.className:"无"}</td>
                <td><font color="#00CC99">${threeCourse != null ? threeCourse.teacherName:"无"}</font></td>
                <td>${threeCourse != null ? threeCourse.teacherPhone:"无"}</td>
                <td>${oneCourse != null ? threeCourse.remark:"无"}</td>
                <c:if test="${sessionScope.admin != null}">
                <td>
                    <c:choose>
                        <c:when test="${threeCourse != null }">
                            <div class="button-group">
                                <a class="button border-main" href="<%=basePath%>toEditCTR?id=${threeCourse.id}">
                                    <span class="icon-edit"></span> 修改
                                </a>
                                <a class="button border-red" href="javascript:void(0)" onclick="return del(${threeCourse.id})">
                                    <span class="icon-trash-o"></span> 删除</a>
                            </div>
                        </c:when>
                        <c:otherwise></c:otherwise>
                    </c:choose>
                </td>
                </c:if>
            </tr>
            <tr>
                <input type="hidden" name="id"  value="${fourCourse.id}" />
                <td> 第四节</td>
                <td>${fourCourse != null ? fourCourse.laboratoryName:"无"}</td>
                <td>${fourCourse != null ? fourCourse.courseName:"无"}</td>
                <td>${fourCourse != null ? fourCourse.className:"无"}</td>
                <td><font color="#00CC99">${fourCourse != null ? fourCourse.teacherName:"无"}</font></td>
                <td>${fourCourse != null ? fourCourse.teacherPhone:"无"}</td>
                <td>${oneCourse != null ? fourCourse.remark:"无"}</td>
                <c:if test="${sessionScope.admin != null}">
                <td>
                    <c:choose>
                        <c:when test="${fourCourse != null }">
                            <div class="button-group">
                                <a class="button border-main" href="<%=basePath%>toEditCTR?id=${fourCourse.id}">
                                    <span class="icon-edit"></span> 修改
                                </a>
                                <a class="button border-red" href="javascript:void(0)" onclick="return del(${fourCourse.id})">
                                    <span class="icon-trash-o"></span> 删除</a>
                            </div>
                        </c:when>
                        <c:otherwise></c:otherwise>
                    </c:choose>
                </td>
                </c:if>
            </tr>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>晚餐时间，注意户外活动，要早睡</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <c:if test="${sessionScope.admin != null}">
                        <td></td>
                    </c:if>

                </tr>

        </table>
    </div>
</form>
<script type="text/javascript">

    //搜索
    function changesearch(){
        alert($("#laboratoryId").val()+"==="+$("#daysId").val())
        window.location.href = "/ctr/ctrList?laboratoryId="+$("#laboratoryId").val()+"&daysId="+$("#daysId").val();
    }

    //单个删除
    function del(id){
        if(confirm("您确定要删除吗?")){
            window.location.href = "/ctr/delCTR?id="+id;
        }
    }



</script>
</body>
</html>
